package com.accp.vehiclecare.biz.xzhbiz;

import com.accp.vehiclecare.dao.xzhdao.ArvehicleDao;
import com.accp.vehiclecare.pojo.Arvehicle;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service("ArvehicleBiz")
public class ArvehicleBiz extends ServiceImpl<ArvehicleDao, Arvehicle> {

    /**
     * 新增外勤车辆
     * @param arvehicle
     * @return
     */
    @Transactional(propagation = Propagation.REQUIRED)
    public boolean addArvehicle(Arvehicle arvehicle){
        int count = super.baseMapper.insert(arvehicle);
        return count !=0;
    }

    /**
     * 删除外勤车辆
     * @param id
     * @return
     */
    @Transactional(propagation = Propagation.REQUIRED)
    public boolean removeArvehicle(Integer id){
        int count = super.baseMapper.deleteById(id);
        return  count !=0;
    }

    /**
     * 修改外勤车辆
     * @param arvehicle
     * @return
     */
    @Transactional(propagation = Propagation.REQUIRED)
    public boolean amendArvehicle(Arvehicle arvehicle){
        int count = super.baseMapper.updateById(arvehicle);
        return count !=0;
    }


}
